using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;

// Liors Code
using System.Net.NetworkInformation;
using System.Diagnostics;
using System.Runtime.InteropServices;
//using System.Diagnostics.PerformanceCounter;
using CommLayer;
using Tamir.IPLib;
using Tamir.IPLib.Packets;
using Magnolia;

namespace TextOverlay
{
    //struct CDiagnostics
    //{
           
    //    //First you have to create the 2 performance counters 
    //    //using the System.Diagnostics.PerformanceCounter class. 
    //    private PerformanceCounter cpuCounter;
    //    private PerformanceCounter ramCounter;
    //    private float Fl;   // Frame lost rate
    //    private bool Ld;    // Lost direct3d device
    //    private bool Bt;    // Bad Timeline
    //    public int status;
    //    public int counter;

    //    public CDiagnostics(bool Nada)
    //    {
    //        //cpuCounter = new PerformanceCounter();
    //        //ramCounter = new PerformanceCounter("Memory", "Available MBytes"); 

    //        //cpuCounter.CategoryName = "Processor"; 
    //        //cpuCounter.CounterName = "% Processor Time"; 
    //        //cpuCounter.InstanceName = "_Total";

    //        counter = 0;
    //        status = 0;
    //        Fl = 0.0f;
    //        Ld = false;
    //        Bt = false;
    //    }    

    //    private float GetCpuUsage()
    //    { 
    //        return cpuCounter.NextValue(); 
    //    } 

    //    private float GetRamUsage()
    //    { 
    //        return ramCounter.NextValue(); 
    //    }

    //    public int GetPfUsage()
    //    {
    //        long TotalMemory = 0;
    //        Process[] PL = Process.GetProcesses();
    //        foreach (Process P in PL)
    //        {
    //            TotalMemory += P.PagedMemorySize64;
    //        }

    //        return Convert.ToInt32((TotalMemory / 1024) / 1024);
    //    }

    //    // returns the rate of frames lost
    //    private float GetFlRate()
    //    {
    //        return Fl;
    //    }

    //    public void GetDiagnostic()
    //    {
    //        status = 0;
            
    //        // if low memory
    //        if (GetRamUsage() < 500.0f)
    //            status += 1;

    //        // if high Page File usage
    //        if (GetPfUsage() > 1000)
    //            status += 2;

    //        // if high Page File usage
    //        if (GetFlRate() > 40.0f)
    //            status += 4;

    //        // if the direct3d device is lost
    //        if (Ld == true)
    //            status += 8;

    //        // if we are losing timeline updates
    //        if (Bt == true)
    //            status += 16;
    //    }
    //}
}